using MallApi.Common;
using Microsoft.AspNetCore.Mvc;
using Services;

namespace MallApi.Controllers;

[ApiController]
[Route("api_v2/home")]
public class HomeController : Controller
{
    private readonly IHomeService _homeService;

    public HomeController(IHomeService homeService)
    {
        _homeService = homeService;
    }

    [HttpGet]
    public async Task<ApiResult<object>> Index()
    {
        var data = new
        {
            navigation = await _homeService.GetNavigationAsync(),
            banner_list = await _homeService.GetBannerListAsync(),
            data_list = await _homeService.GetRecommendedGoodsAsync(),
            ads = _homeService.GetAdvertisementsAsync(),
            hot_search = await _homeService.GetHotSearchKeywordsAsync(),
            common_shop_notice = "",
            common_app_is_enable_search = 1,
            common_app_is_enable_answer = 1,
            is_spike = ""
        };

        return ApiResult<object>.Success(data);
    }
}